<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="referrer" content="no-referrer">
<script src="http://cdn.staticfile.org/jquery/1.9.1/jquery.min.js"></script>
<style>
	.vid-wrap{
    width:100%;background: #000;
    position:relative;
    padding-bottom:56.25%;    /*需要用padding来维持16:9比例,也就是9除以16*/
    height: 0;
	}
	.vid-wrap video{
		position: absolute;
		top:0;
		left: 0;
		width: 100%;
		height: 100%
}
</style>
<body>
<div id="vd" class="vid-wrap" ></div>
<audio id="player" autoplay="autoplay"></audio>
<script>
    function callbackfunction(j){
				var u = j.durl[0].url;
				$("#vd").html('<video   src="'+u+'" preload="auto" autoplay="" controls="" class="embed-responsive-item"></video>')
				$("#page1").attr("href",j.durl[0].url);
    }
    function parseVideo(aid,page){
				$.getScript("http://api.bilibili.com/playurl?callback=callbackfunction&aid="+aid+"&platform=html5&quality=6&page="+page+"&vtype=mp4&type=jsonp");
    }
	function getQueryVariable(variable)
	{
		   var query = window.location.search.substring(1);
		   var vars = query.split("&");
		   for (var i=0;i<vars.length;i++) {
				   var pair = vars[i].split("=");
				   if(pair[0] == variable){return pair[1];}
		   }
		   return(false);
	}
	aid=getQueryVariable("aid");
	page=getQueryVariable("page");
	if(page==false) page=1;
    parseVideo(aid,page)
	function get(){
		$("#vd").html('<video   src="" preload="auto" autoplay="" controls="" class="embed-responsive-item"></video>')
    }
</script>

</body>
</html>

